# 测试用例层
from interface.Event import Event


class EventCase:
    def __init__(self):
        self.event = Event()

    # 添加发布会
    def test_add_event(self):
        body = {
            'eid': '12345',
            'name': '苹果14134',
            'limit': '20',
            'status': '1',
            'address': '源码时代',
            'start_time': '2022-7-20'
        }
        result = self.event.add_event(body)
        print(result)
        # 断言响应状态码
        status_code = result.get('status_code')
        assert status_code == 200
        # 断言返回值
        status = result.get('body').get('status')
        assert status == 10200
        # 断言message
        message = result.get('body').get('message')
        assert message == 'add event success'

    # 查询发布会
    def test_get_event(self):
        result1 = self.event.get_event(eid='12345', name='苹果14134')
        print(result1)
        # 断言响应状态码
        status_code1 = result1.get('status_code')
        assert status_code1 == 200
        # 断言返回值
        status1 = result1.get('body').get('status')
        assert status1 == 10200
        # 断言message
        message = result1.get('body').get('message')
        assert message == 'success'


if __name__ == '__main__':
    # EventCase().test_add_event()
    EventCase().test_get_event()
